/*    */ package com.zimbra.cs.redolog.op;
/*    */ 
/*    */ import com.zimbra.common.util.Log;
/*    */ import com.zimbra.cs.mailbox.MailServiceException;
/*    */ import com.zimbra.cs.mailbox.Mailbox;
/*    */ import com.zimbra.cs.mailbox.MailboxManager;
/*    */ import com.zimbra.cs.mailbox.MailboxOperation;
/*    */ import com.zimbra.cs.redolog.RedoLogInput;
/*    */ import com.zimbra.cs.redolog.RedoLogOutput;
/*    */ import java.io.IOException;
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ public class SaveWiki
/*    */   extends SaveDocument
/*    */ {
/*    */   private String mWikiword;
/*    */   
/*    */   public SaveWiki()
/*    */   {
/* 34 */     this.mOperation = MailboxOperation.SaveWiki;
/*    */   }
/*    */   
/*    */   public SaveWiki(int mailboxId, String digest, int msgSize, int folderId) {
/* 38 */     super(mailboxId, digest, msgSize, folderId, 0);
/* 39 */     this.mOperation = MailboxOperation.SaveWiki;
/*    */   }
/*    */   
/*    */   public String getWikiword() {
/* 43 */     return this.mWikiword;
/*    */   }
/*    */   
/*    */   public void setWikiword(String w) {
/* 47 */     this.mWikiword = w;
/*    */   }
/*    */   
/*    */   protected void serializeData(RedoLogOutput out) throws IOException {
/* 51 */     out.writeUTF(this.mWikiword);
/* 52 */     super.serializeData(out);
/*    */   }
/*    */   
/*    */   protected void deserializeData(RedoLogInput in) throws IOException {
/* 56 */     this.mWikiword = in.readUTF();
/* 57 */     super.deserializeData(in);
/*    */   }
/*    */   
/*    */   public void redo() throws Exception {
/* 61 */     Mailbox mbox = MailboxManager.getInstance().getMailboxById(getMailboxId());
/*    */     try {
/* 63 */       mbox.createWiki(getOperationContext(), getFolderId(), this.mWikiword, getAuthor(), getDescription(), getAdditionalDataStream());
/*    */     } catch (MailServiceException e) {
/* 65 */       if (e.getCode() == "mail.ALREADY_EXISTS") {
/* 66 */         mLog.info("Wiki " + getMessageId() + " is already in mailbox " + mbox.getId());
/* 67 */         return;
/*    */       }
/* 69 */       throw e;
/*    */     }
/*    */   }
/*    */ }


/* Location:              /home/mint/zimbrastore.jar!/com/zimbra/cs/redolog/op/SaveWiki.class
 * Java compiler version: 7 (51.0)
 * JD-Core Version:       0.7.1
 */